﻿using Quartz;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TXTD.Admin.ScheduledTask.Listeners
{
    public class TriggerServiceListener : ITriggerListener
    {
        public string Name => GetType().Name;

        public async Task TriggerComplete(ITrigger trigger, IJobExecutionContext context, SchedulerInstruction triggerInstructionCode, CancellationToken cancellationToken = default)
        {
            await Console.Error.WriteLineAsync("TriggerComplete");
        }

        public async Task TriggerFired(ITrigger trigger, IJobExecutionContext context, CancellationToken cancellationToken = default)
        {
            await Console.Error.WriteLineAsync("TriggerFired");
        }

        public async Task TriggerMisfired(ITrigger trigger, CancellationToken cancellationToken = default)
        {
            await Console.Error.WriteLineAsync("TriggerMisfired");
        }

        public async Task<bool> VetoJobExecution(ITrigger trigger, IJobExecutionContext context, CancellationToken cancellationToken = default)
        {
            await Console.Error.WriteLineAsync("VetoJobExecution");
            return true;
        }
    }
}
